#pragma once

#include <atomic>
#include <memory>

#include "any.h"
#include "semaphore.h"
#include "task.h"
class Task;
class Result {
public:
    Result(std::shared_ptr<Task> task, bool isValid = true);
    ~Result() = default;

    void setVal(Any any);
    Any get();

private:
    Any any_;
    Semaphore sema_;
    std::shared_ptr<Task> task_;
    std::atomic_bool isValid_;
};
